Skip to contentMethod: StringSymbol(String, Position)
      1: package symbols;
2: 
3: import model.Position;
4: import scanner.ScannerConstants;
5: 
6: /**
7:  * 
8:  * This class represents String symbol.
9:  * 
10:  */
11: public class StringSymbol extends AbstractSymbol {
12:         /**
13:          * This attribute is the text of the String.
14:          */
15:         private final transient String text;
16: 
17:         /**
18:          * This constructor initialize the String Symbol.
19:          * 
20:          * @param text
21:          *            is the text of the String.
22:          * @param position
23:          *            is the row and column of the data in the stream.
24:          */
25:         public StringSymbol(final String text, final Position position) {
26:                 super(position);
27:                 this.text = text;
28:         }
29: 
30:         /**
31:          * 
32:          * This method returns the attribute text.
33:          * 
34:          * @return the text.
35:          * 
36:          */
37:         public String getText() {
38:                 return this.text;
39: 
40:         }
41: 
42:         @Override
43:         public String toString() {
44:                 return ScannerConstants.STRING + this.text + this.getPosition();
45:         }
46: 
47:         @Override
48:         public boolean equals(final Object obj) {
49:                 return super.equals(obj) && obj instanceof StringSymbol
50:                                 && ((StringSymbol) obj).getText().equals(this.getText());
51:         }
52: 
53:         @Override
54:         public int hashCode() {
55:                 return super.hashCode() + this.text.hashCode();
56:         }
57: }